const path = require('path')

const mineTypes = {
  'css': {
    text: 'text/css',
    icon: '/static/images/css.png'
  },
  'html': {
    text: 'text/html',
    icon: '/static/images/html.png'
  },
  'jpg': {
    text: 'image/jpeg',
    icon: '/static/images/html.png'
  },
  'json': {
    text: 'application/json',
    icon: '/static/images/json.png'
  },
  'txt': {
    text: 'text/plain',
    icon: '/static/images/file.png'
  },
  'js': {
    text: 'text/javascript',
    icon: '/static/images/js.png'
  },
}

module.exports = (filePath) => {
  let ext = path.extname(filePath).split('.').pop().toLowerCase()
  return mineTypes[ext] || mineTypes['txt']
}